Add FloatingLiteral.ValueAsFloat and ValueAsDouble.#675
Add FloatingLiteral.ValueAsFloat and ValueAsDouble.#675rolfbjarne wants to merge 1 commit intodotnet:mainfrom
Conversation
| return 0; | ||
| } | ||
|
|
||
| unsigned clangsharp_Cursor_getFloatingLiteralValueAsDouble(CXCursor C, double* value) { |
There was a problem hiding this comment.
Not sure I understand the need for these APIs?
ValueAsApproximateDouble only loses data in the case that we have some "more precise" type than double, such as x87DoubleExtended or IEEEquad (which aren't portable to C# right now anyways).
So what it looks like you want is just some unsigned clangsharp_Cursor_isFloatingLiteralRepresentableBy(CXCursor C, CX_FloatingSemantics semantics).
Such an API then allows this to be more generally supported in managed land instead, as you can simply check "is the floating-literal regardless of semantics losslessly representable by this other semantic". You can then take and cast ValueAsApproximateDouble to the target format in that case for the two types that are being supported here.
There was a problem hiding this comment.
OK, I'll try ValueAsApproximateDouble and see if that works.
There was a problem hiding this comment.
ValueAsApproximateDouble works fine, so this is not needed, thanks!
No description provided.